home *** CD-ROM | disk | FTP | other *** search
/ MacFormat España 26 / macformat_26.iso / Shareware / Programación / C Reference Card / C Reference Card.rsrc / TEXT_415_15.txt < prev    next >
Text File  |  1997-01-29  |  19KB  |  728 lines

  1. PROGRAMMING THE MAC : about, compiler, references, sample application
  2. _________________________________________________________________________
  3.  
  4.  
  5. ABOUT THIS SECTION
  6.  
  7. This section does NOT provide a detailed explanation on how to program for the Macintosh.  There are other (and better) sources for this type of information.  What this section DOES provide is a suggested approach for learning how to start programming for the Macintosh (System 7) and what sort of tools and documentation you'll need based on personal experience.
  8.  
  9. Also provided is a sample System 7 application which can be used as a reference.  Learning C or C++ is a fairly straightforward experience.  Attempting the tackle graphical programming can be a much more daunting task.
  10.  
  11. You'd think that learning to program the Macintosh (or any graphical environment) would consist of buying one book, start at the beginning, and a few days later finish the book with a thorough knowledge of everything you needed to know.  Well, it simply ain't so.  There are literally volumes of reference material from Apple on all of the Managers which comprise the MacOS.  Managers are groups of related functions.  Examples of which are the QuickDraw Manager, TextEdit Manager, Menu Manager, etc.  There are dozens of Managers and THOUSANDS of functions which comprise the Toolbox.
  12.  
  13. If your new to programming, learn C/C++ first.  Don't worry about windows and graphical interfaces until you have a solid understanding of the core language.  This means that you'll be stuck using text-based interfaces for awhile, but you'll be a lot less frustrated when it comes time to using pointers, handles, and data structures inherent with the MacOS.
  14.  
  15.  
  16.  
  17. PURCHASING A COMPILER
  18.  
  19. There are basically two choices for C/C++ compilers for the Macintosh; Symantec C++ and CodeWarrior by Metrowerks.  Both are similarly priced and both are full-featured compilers.  Symantec C++ has been around for longer, but Code Warrior is generally considered the platform of choice.
  20.  
  21.  
  22.  
  23. REFERENCE MATERIAL
  24.  
  25. The following is the minimum recommended reference material you should start out with if you intend on programming for the Macintosh (System 7):
  26.  
  27. Inside Macintosh: Overview
  28. Inside Macintosh: Macintosh Toolbox Essentials
  29. Inside Macintosh: Imaging with QuickDraw
  30. Symantec THINK Reference and/or APDA Toolbox Assistant
  31. A good C/C++ book
  32.  
  33. There are currently over two dozen "Inside Macintosh" books available from Apple.  You can easily order these books (as well as your compiler) through APDA (Apple Program Developers Association).  APDA can be reached at 1-800-282-2732 or over the net at http://www.devcatalog.apple.com.
  34.  
  35. Most of documentation in the Inside Macintosh reference books uses Pascal programming conventions.  This is a throwback to the programming language preference at the time the Mac was originally introduced.  Expect major changes with the NeXT MacOS.
  36.  
  37.  
  38.  
  39. A COMPLETE SAMPLE APPLICATION
  40.  
  41. The following is a complete System 7 application.  It represents watered-down code in that there is limited error-checking and no support for things like AppleEvents, Scripting, or Balloon Help.  However, it does provide the basic event-loop which almost all Macintosh applications are based on.
  42.  
  43. The sample application consists of two files; starter.cp and resources.r
  44.  
  45.  
  46. /************************* Segment: starter.cp **************************
  47.                      
  48.   All functions and sub-routines are identified with an underscore '_' 
  49.   at the end of the function name.  This hopefully helps to identify
  50.   program functions from Toolbox calls.
  51.                 
  52. */
  53.  
  54. /********** Includes */
  55. #include <Editions.h>
  56.  
  57. /********** Define Statements */
  58. #define kNilPtr             0L
  59. #define kMoveToFront        (WindowPtr)-1L
  60. #define kLeaveIt            false
  61. #define kRemoveEvents       0
  62. #define kSleep              60L
  63. #define kNilMouseRegion     0L
  64. #define kWaitNextEventTrap  0x60
  65. #define kUnimplementedTrap  0x9F
  66. #define kMinimumSysVersion  0x700  // minimum system version required
  67.  
  68. /********** General */
  69. const short kDragThreshold = 30;
  70. const unsigned char *kNilStr = "\p";
  71. const unsigned char *kFatalErrorStr = "\pFatal Error!";
  72.  
  73. /********** Window definitions */
  74. const short kNewWindow =    400;
  75. const short kWindowLeft =   5;
  76. const short kWindowTop =    45;
  77. const short kWindowOffset = 20;
  78.  
  79. /********** Alerts */
  80. const short kAboutAlert =   400;
  81. const short kErrorAlert =   401;
  82.  
  83. /********** Param Text */
  84. const short kGeneralError = 400;
  85. const short kBadSystem =    401;
  86. const short kNoMenuBarRes = 402;
  87. const short kNoMenuRes =    403;
  88. const short kNoWindowRes =  404;
  89.  
  90. /********** Menu Stuff */
  91. const short kMenuBar =      400;
  92. const short kAppleMenu =    400;
  93. const short kFileMenu =     401;
  94. const short kEditMenu =     402;
  95. const short kAppleAbout =   1;
  96. const short kFileNew =      1;
  97. const short kFileClose =    2;
  98. const short kFileQuit =     3;
  99. const short kEditUndo =     1;
  100. const short kEditCut =      2;
  101. const short kEditCopy =     3;
  102. const short kEditPaste =    4;
  103. const short kEditClear =    6;
  104.  
  105. /********** Structures */
  106. struct SysConfigRec
  107. {
  108.     Boolean hasGestalt;
  109.     Boolean hasWNE;
  110.     Boolean hasColorQD;
  111.     Boolean hasAppleEvents;
  112.     Boolean hasEditionMgr;
  113.     Boolean hasHelpMgr;
  114.  
  115.     long    sysVersion;
  116. };
  117.  
  118. /********** Global Variables */
  119. Boolean             gDone;
  120. EventRecord         gTheEvent;
  121. MenuHandle          gAppleMenu;
  122. MenuHandle          gFileMenu;
  123. MenuHandle          gEditMenu;
  124. Rect                gDragRect;
  125. short               gAppResourceFile;
  126. struct SysConfigRec gSysConfig;
  127. int                 gNewWindowLeft = kWindowLeft;
  128. int                 gNewWindowTop = kWindowTop;
  129.  
  130. /********** Prototypes */
  131. void main( void );
  132. void ToolBoxInit_( void );
  133. static void GetSysConfig_( void );
  134. Boolean TrapAvailable_( short tNumber, TrapType tType );
  135. void MenuBarInit_( void );
  136. void SetUpDragRect_( void );
  137. void HandleEvent_( void );
  138. void DoMouseDown_( void );
  139. void AdjustMenus_( void );
  140. short IsDAWindow_( WindowPtr w );
  141. void DoMenuChoice_( long int menuChoice );
  142. void DoAppleChoice_( int theItem );
  143. void DoFileChoice_( int theItem );
  144. void DoEditChoice_( int theItem );
  145. void DoCreateWindow_( void );
  146. void ErrorHandler_( int stringNum, int quitFlag );
  147.  
  148.  
  149. /********** main */
  150.  
  151. void main( void )
  152. {
  153.     ToolBoxInit_();
  154.     GetSysConfig_();
  155.     MenuBarInit_();
  156.     SetUpDragRect_();
  157.     DoCreateWindow_();
  158.     
  159.     gDone = false;
  160.     while( gDone == false )
  161.         HandleEvent_();
  162. }
  163.  
  164.  
  165. /********** ToolBoxInit */
  166.  
  167. void ToolBoxInit_( void )
  168. {
  169.     // Standard initialization procedure per IM:Overview p4-75
  170.  
  171.     MaxApplZone();
  172.     MoreMasters();
  173.     
  174.     InitGraf( &qd.thePort );
  175.     InitFonts();
  176.     InitWindows();
  177.     InitMenus();
  178.     TEInit();
  179.     InitDialogs( kNilPtr );
  180.     
  181.     FlushEvents( everyEvent, kRemoveEvents );    
  182.     InitCursor();
  183. }
  184.  
  185.  
  186. /********** GetSysConfig */
  187.  
  188. static void GetSysConfig_( void )
  189. {   
  190.     OSErr        ignoreError;
  191.     long         tempLong;
  192.     SysEnvRec    environs;
  193.     short        myBit;
  194.  
  195.     // set app resource fork ID
  196.     gAppResourceFile = CurResFile();
  197.  
  198.     // check to see if Gestalt Manager is supported
  199.     gSysConfig.hasGestalt = TrapAvailable_( _Gestalt, ToolTrap );
  200.     if( !gSysConfig.hasGestalt )
  201.         // something has got to be wrong
  202.         ErrorHandler_( kGeneralError, true );
  203.     else
  204.     {
  205.         // determine system configuration
  206.  
  207.         gSysConfig.hasWNE = TrapAvailable_( _WaitNextEvent, ToolTrap );
  208.         
  209.         ignoreError = Gestalt( gestaltQuickdrawVersion, &tempLong );
  210.         gSysConfig.hasColorQD = ( tempLong != gestaltOriginalQD );
  211.         
  212.         gSysConfig.hasAppleEvents = ( Gestalt( gestaltAppleEventsAttr,
  213.             &tempLong ) == noErr );
  214.  
  215.         gSysConfig.hasEditionMgr = ( Gestalt( gestaltEditionMgrAttr,
  216.             &tempLong ) == noErr );
  217.         if( gSysConfig.hasEditionMgr )
  218.             if( InitEditionPack() != noErr )
  219.                 gSysConfig.hasEditionMgr = false;
  220.                 
  221.         ignoreError = Gestalt( gestaltHelpMgrAttr, &tempLong );
  222.         myBit = gestaltHelpMgrPresent;
  223.         gSysConfig.hasHelpMgr =
  224.             BitTst( &tempLong, 31 - myBit );
  225.             
  226.         gSysConfig.sysVersion = 0.0;
  227.         ignoreError = Gestalt( gestaltSystemVersion, &tempLong );
  228.         gSysConfig.sysVersion = tempLong;
  229.         if( kMinimumSysVersion > gSysConfig.sysVersion )
  230.             ErrorHandler_( kBadSystem, true );
  231.     }
  232. }
  233.  
  234.  
  235. /********** TrapAvailable */
  236.  
  237. Boolean TrapAvailable_( short tNumber, TrapType tType )
  238. {
  239.     return( NGetTrapAddress( tNumber, tType ) 
  240.     != GetTrapAddress( _Unimplemented ) );
  241. }
  242.  
  243.  
  244. /********** MenuBarInit */
  245.  
  246. void MenuBarInit_( void )
  247. {
  248.     Handle  myMenuBar;
  249.  
  250.     if( ( myMenuBar = GetNewMBar( kMenuBar ) ) == kNilPtr )
  251.         ErrorHandler_( kNoMenuBarRes, true );
  252.     SetMenuBar( myMenuBar );
  253.     
  254.     gAppleMenu = GetMHandle( kAppleMenu );
  255.     gFileMenu = GetMHandle( kFileMenu );
  256.     gEditMenu = GetMHandle( kEditMenu );
  257.     if( gAppleMenu == kNilPtr || gFileMenu == kNilPtr || 
  258.       gEditMenu == kNilPtr ) ErrorHandler_( kNoMenuRes, true );
  259.     AddResMenu( gAppleMenu, 'DRVR' );
  260.     DrawMenuBar();
  261. }
  262.  
  263.  
  264. /********** SetUpDragRect */
  265.  
  266. void SetUpDragRect_( void )
  267. {
  268.     gDragRect = qd.screenBits.bounds;
  269.     gDragRect.left += kDragThreshold;
  270.     gDragRect.right -= kDragThreshold;
  271.     gDragRect.bottom -= kDragThreshold;
  272. }
  273.  
  274.  
  275. /********** HandleEvent */
  276.  
  277. void HandleEvent_( void )
  278. {
  279.     char      theChar;
  280.     GrafPtr   oldPort;
  281.     WindowPtr w;
  282.     
  283.     if( gSysConfig.hasWNE )
  284.         WaitNextEvent( everyEvent, &gTheEvent, kSleep, kNilMouseRegion );
  285.     else
  286.     {
  287.         SystemTask();
  288.         GetNextEvent( everyEvent, &gTheEvent );
  289.     }
  290.  
  291.     switch( gTheEvent.what )
  292.     {
  293.         case mouseDown: 
  294.             DoMouseDown_();
  295.             break;
  296.         case mouseUp:
  297.             // this application doesn't use mouseUp events
  298.             break;
  299.         case keyDown:
  300.         case autoKey:
  301.             theChar = gTheEvent.message & charCodeMask;
  302.             if(( gTheEvent.modifiers & cmdKey ) != 0)
  303.             {
  304.                 AdjustMenus_(); 
  305.                 DoMenuChoice_( MenuKey( theChar ) );
  306.             }
  307.             else
  308.             {
  309.                 /* Handle text from keyboard */
  310.             }
  311.             break;
  312.         case updateEvt:
  313.             if( !IsDAWindow_( (WindowPtr)gTheEvent.message ) )
  314.             {
  315.                 w = (WindowPtr)gTheEvent.message;
  316.                 GetPort( &oldPort );
  317.                 SetPort( w );
  318.                 BeginUpdate( w );
  319.  
  320.                     // perform and update/drawing here
  321.  
  322.                 EndUpdate( w );
  323.                 SetPort( oldPort );
  324.             }
  325.             break;
  326.         case diskEvt:
  327.             // most applications don't need to worry about diskEvt's
  328.              break;
  329.         case activateEvt:
  330.             // this application doesn't need to worry about activateEvt's
  331.             if( !IsDAWindow_( (WindowPtr)gTheEvent.message ) )
  332.             {
  333.                 if( gTheEvent.modifiers & activeFlag )
  334.                 {
  335.                     /* Handle activate event. */
  336.                 }
  337.                 else
  338.                 {
  339.                     /* Handle deactivate event. */
  340.                 }
  341.             }
  342.             break;
  343.         case osEvt:
  344.             // this application doesn't support operating sys events
  345.             break;
  346.         case nullEvent:
  347.             // ignore
  348.             break;
  349.      /*
  350.         case kHighLevelEvent:
  351.             // this application doesn't support high level events
  352.             // need to #include <Events.h> to define kHighLevelEvent
  353.             break;
  354.      */
  355.     }
  356. }
  357.  
  358.  
  359. /********** DoMouseDown */
  360.  
  361. void DoMouseDown_( void )
  362. {
  363.     WindowPtr   w;
  364.     short int   thePart;
  365.     long int    menuChoice;    
  366.     Point       theLocation;
  367.     
  368.     thePart = FindWindow( gTheEvent.where, &w );
  369.     switch( thePart )
  370.     {
  371.         case inMenuBar:
  372.             AdjustMenus_();
  373.             menuChoice = MenuSelect( gTheEvent.where );
  374.             DoMenuChoice_( menuChoice );
  375.             break;
  376.         case inSysWindow: 
  377.             SystemClick( &gTheEvent, w );
  378.             break;
  379.         case inContent:
  380.             if( w != FrontWindow() )
  381.                 SelectWindow( w );
  382.             else if( !IsDAWindow_( (WindowPtr)gTheEvent.message ) )
  383.                 /* Handle click in window content */ ;
  384.             break;
  385.         case inDrag: 
  386.             DragWindow( w, gTheEvent.where, &gDragRect );
  387.             break;
  388.         case inGrow:
  389.             // not used in this application
  390.             break;
  391.         case inGoAway:
  392.             theLocation = gTheEvent.where;
  393.             GlobalToLocal( &theLocation );
  394.             if( TrackGoAway( w, theLocation ) )
  395.                 DisposeWindow( w );
  396.             break;
  397.         case inZoomIn:
  398.         case inZoomOut:
  399.             // not used in this application
  400.             break;
  401.     }
  402. }
  403.  
  404.  
  405. /********** AdjustMenus */
  406.  
  407. void AdjustMenus_( void )
  408. {
  409.     WindowPtr w;
  410.  
  411.     if(IsDAWindow_( FrontWindow() ) )
  412.     {
  413.         EnableItem( gEditMenu, kEditUndo );
  414.         EnableItem( gEditMenu, kEditCut );
  415.         EnableItem( gEditMenu, kEditCopy );
  416.         EnableItem( gEditMenu, kEditPaste );
  417.         EnableItem( gEditMenu, kEditClear );
  418.     }
  419.     else
  420.     {
  421.         DisableItem( gEditMenu, kEditUndo );
  422.         DisableItem( gEditMenu, kEditCut );
  423.         DisableItem( gEditMenu, kEditCopy );
  424.         DisableItem( gEditMenu, kEditPaste );
  425.         DisableItem( gEditMenu, kEditClear );
  426.     }
  427.         
  428.     if( ( w = FrontWindow() ) == kNilPtr )
  429.         DisableItem( gFileMenu, kFileClose );
  430.     else
  431.         EnableItem( gFileMenu, kFileClose );
  432. }
  433.  
  434.  
  435. /********** IsDAWindow */
  436.  
  437. short IsDAWindow_( WindowPtr w )
  438. {
  439.     if( w == kNilPtr )
  440.         return( false );
  441.     else /* DA windows have negative windowKinds */
  442.         return( ( (WindowPeek)w )->windowKind < 0 );
  443. }
  444.  
  445.  
  446. /********** DoMenuChoice */
  447.  
  448. void DoMenuChoice_( long int menuChoice )
  449. {
  450.     int    theMenu;
  451.     int    theItem;
  452.     
  453.     if( menuChoice != 0 )
  454.     {
  455.         theMenu = HiWord( menuChoice );
  456.         theItem = LoWord( menuChoice );
  457.         switch( theMenu )
  458.         {
  459.             case kAppleMenu :
  460.                 DoAppleChoice_( theItem );
  461.                 break;
  462.             case kFileMenu :
  463.                 DoFileChoice_( theItem );
  464.                 break;
  465.             case kEditMenu :
  466.                 DoEditChoice_( theItem );
  467.                 break;
  468.         }
  469.         HiliteMenu( 0 );
  470.     }
  471. }
  472.  
  473.  
  474. /********** DoAppleChoice */
  475.  
  476. void DoAppleChoice_( int theItem )
  477. {
  478.     Str255  accName;
  479.     int     accNumber;
  480.     
  481.     switch( theItem )
  482.     {
  483.         case kAppleAbout : 
  484.             NoteAlert( kAboutAlert, kNilPtr );
  485.             break;
  486.         default :
  487.             GetItem( gAppleMenu, theItem, accName );
  488.             accNumber = OpenDeskAcc( accName );
  489.             break;
  490.     }
  491. }
  492.  
  493.  
  494. /********** DoFileChoice */
  495.  
  496. void DoFileChoice_( int theItem )
  497. {
  498.     WindowPtr   w;
  499.  
  500.     switch( theItem )
  501.     {
  502.         case kFileNew :
  503.             DoCreateWindow_();
  504.             break;
  505.         case kFileClose :
  506.             if( ( w = FrontWindow() ) != kNilPtr )
  507.                 DisposeWindow( w );
  508.             break;
  509.         case kFileQuit :
  510.             gDone = TRUE;
  511.             break;
  512.     }
  513. }
  514.  
  515.  
  516. /********** DoEditChoice */
  517.  
  518. void DoEditChoice_( int theItem )
  519. {
  520.     if( SystemEdit( theItem - 1 ) == 0 )
  521.     {
  522.         /* Add Edit menu switch statement here */
  523.     }
  524. }
  525.  
  526.  
  527. /********** DoCreateWindow */
  528.  
  529. void DoCreateWindow_( void )
  530. {
  531.     WindowPtr    w;
  532.     
  533.     w = GetNewWindow( kNewWindow, kNilPtr, kMoveToFront );
  534.     if(((qd.screenBits.bounds.right - gNewWindowLeft) < kDragThreshold) ||
  535.         ((qd.screenBits.bounds.bottom - gNewWindowTop) < kDragThreshold))
  536.     {
  537.         gNewWindowLeft = kWindowLeft;
  538.         gNewWindowTop = kWindowTop;
  539.     }
  540.     MoveWindow( w, gNewWindowLeft, gNewWindowTop, kLeaveIt );
  541.     gNewWindowLeft += kWindowOffset;
  542.     gNewWindowTop += kWindowOffset;
  543.     ShowWindow( w );
  544. }
  545.  
  546.  
  547. /********** ErrorHandler */
  548.  
  549. void ErrorHandler_( int stringNum, int quitFlag )
  550. {
  551.     StringHandle   errorStringH;
  552.     
  553.     if( ( errorStringH = GetString( stringNum ) ) == kNilPtr )
  554.         ParamText( kFatalErrorStr, kNilStr, kNilStr, kNilStr );
  555.     else
  556.     {
  557.         HLock( (Handle)errorStringH );
  558.         ParamText( *errorStringH, kNilStr, kNilStr, kNilStr );
  559.         HUnlock( (Handle)errorStringH );
  560.     }
  561.     StopAlert( kErrorAlert, kNilPtr );
  562.     if( quitFlag )
  563.         ExitToShell();
  564. }
  565.  
  566.  
  567. /************************* Segment: resources.r ************************/
  568.  
  569. #include <Types.r>
  570.  
  571. resource 'WIND' (400, "Main WIND") {
  572.     {45, 5, 205, 181},
  573.     noGrowDocProc,
  574.     invisible,
  575.     goAway,
  576.     0x0,
  577.     "Window"
  578. };
  579.  
  580. resource 'MENU' (401, "File") {
  581.     401,
  582.     textMenuProc,
  583.     allEnabled,
  584.     enabled,
  585.     "File",
  586.     {    /* array: 3 elements */
  587.         /* [1] */
  588.         "New", noIcon, "N", noMark, plain,
  589.         /* [2] */
  590.         "Close", noIcon, "W", noMark, plain,
  591.         /* [3] */
  592.         "Quit", noIcon, "Q", noMark, plain
  593.     }
  594. };
  595.  
  596. resource 'MENU' (400, "Apple") {
  597.     400,
  598.     textMenuProc,
  599.     0x7FFFFFFD,
  600.     enabled,
  601.     apple,
  602.     {    /* array: 2 elements */
  603.         /* [1] */
  604.         "About...", noIcon, noKey, noMark, plain,
  605.         /* [2] */
  606.         "-", noIcon, noKey, noMark, 1
  607.     }
  608. };
  609.  
  610. resource 'MENU' (402, "Edit", preload) {
  611.     402,
  612.     textMenuProc,
  613.     0x0,
  614.     enabled,
  615.     "Edit",
  616.     {    /* array: 6 elements */
  617.         /* [1] */
  618.         "Undo", noIcon, "Z", noMark, plain,
  619.         /* [2] */
  620.         "-", noIcon, noKey, noMark, plain,
  621.         /* [3] */
  622.         "Cut", noIcon, "X", noMark, plain,
  623.         /* [4] */
  624.         "Copy", noIcon, "C", noMark, plain,
  625.         /* [5] */
  626.         "Paste", noIcon, "V", noMark, plain,
  627.         /* [6] */
  628.         "Clear", noIcon, noKey, noMark, plain
  629.     }
  630. };
  631.  
  632. resource 'MBAR' (400, "Main MBAR") {
  633.     {    /* array MenuArray: 3 elements */
  634.         /* [1] */
  635.         400,
  636.         /* [2] */
  637.         401,
  638.         /* [3] */
  639.         402
  640.     }
  641. };
  642.  
  643. resource 'DITL' (400, "About") {
  644.     {    /* array DITLarray: 2 elements */
  645.         /* [1] */
  646.         {71, 117, 91, 177},
  647.         Button {
  648.             enabled,
  649.             "OK"
  650.         },
  651.         /* [2] */
  652.         {7, 70, 61, 280},
  653.         StaticText {
  654.             enabled,
  655.             "Starter Application - a place to start y"
  656.             "our Macintosh program."
  657.         }
  658.     }
  659. };
  660.  
  661. resource 'DITL' (401, "Fatal Error") {
  662.     {    /* array DITLarray: 2 elements */
  663.         /* [1] */
  664.         {86, 117, 106, 177},
  665.         Button {
  666.             enabled,
  667.             "Exit"
  668.         },
  669.         /* [2] */
  670.         {5, 67, 71, 283},
  671.         StaticText {
  672.             enabled,
  673.             "Fatal error:  ^0"
  674.         }
  675.     }
  676. };
  677.  
  678. resource 'ALRT' (400, "About") {
  679.     {40, 40, 142, 332},
  680.     400,
  681.     {    /* array: 4 elements */
  682.         /* [1] */
  683.         OK, visible, silent,
  684.         /* [2] */
  685.         OK, visible, silent,
  686.         /* [3] */
  687.         OK, visible, silent,
  688.         /* [4] */
  689.         OK, visible, silent
  690.     }
  691. };
  692.  
  693. resource 'ALRT' (401, "Fatal Error") {
  694.     {40, 40, 156, 332},
  695.     401,
  696.     {    /* array: 4 elements */
  697.         /* [1] */
  698.         OK, visible, sound1,
  699.         /* [2] */
  700.         OK, visible, sound1,
  701.         /* [3] */
  702.         OK, visible, sound1,
  703.         /* [4] */
  704.         OK, visible, sound1
  705.     }
  706. };
  707.  
  708. resource 'STR ' (400, "General Error") {
  709.     "An unrecoverable error occured!"
  710. };
  711.  
  712. resource 'STR ' (401, "System Error") {
  713.     "Need to upgrade to System 7!"
  714. };
  715.  
  716. resource 'STR ' (402, "MENUBAR Error") {
  717.     "Couldn't load the MENU Bar resource!"
  718. };
  719.  
  720. resource 'STR ' (403, "MENU Error") {
  721.     "Couldn't load a MENU resource!"
  722. };
  723.  
  724. resource 'STR ' (404, "WIND Error") {
  725.     "Couldn't load a WIND resource!"
  726. };
  727.  
  728. // End of File